package eurekaClient.controller;

import eurekaClient.openFeignService.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
 * @author ：Dongdequan
 * @date ：Created in 2022/4/5 14:31
 * @modified By：
 */
@RestController
@RequestMapping("/test")
public class TestController {

    @Autowired
    private RestTemplate restTemplate;

    @Autowired
    private OrderService orderService;

    @GetMapping("/hello")
    public String hello(@RequestParam("name") String name){
        String result = restTemplate.getForObject("http://127.0.0.1:9006/order/orderByUser", String.class);
        return result;
    }

    @GetMapping("/hello2")
    public String hello2(){
       // String result = restTemplate.getForObject("http://127.0.0.1:9006/order/orderByUser", String.class);
        return orderService.order();
    }
}
